class Employee:
    def __init__(self,name,age):
        self.name = name
        self.__age = age
    def __work(self):
        print("work hard")
        print("{0}".format(self.__age))
e = Employee("ljx",18)
print(e.name)
print(e._Employee__age)

print(dir(e))
e._Employee__work()

class Emp:
    def __init__(self,name,salary):
        self.__name = name
        self.__salary = salary

    @property
    def salary(self):
        return self.__salary

    @salary.setter
    def salary(self,salary):
        if 1000 < salary < 50000:
            self.__salary = salary
        else:
            print("录入错误！薪水在1000-50000这个范围")

'''
 def get_salary(self):
        return self.__salary
    def set_salary(self,salary):
        if 1000<salary<50000:
            self.__salary = salary
        else:
            print("录入错误！薪水在1000-50000这个范围")
'''




emp1 = Emp("ljx",30000)
# print(emp1.get_salary())
# emp1.set_salary(20000)
# print(emp1.get_salary())

print(emp1.salary)
emp1.salary = 200000
print(emp1.salary)

class Person:

    def __init__(self,name,age):
        self.name = name
        self.__age = age

    def say_age(self):
        print("my age:",self.__age)

    def say_introduce(self):
        print("my name is {0}".format(self.name))

    def __str__(self):
        return "名字是:{0}".format(self.name)

class Teacher(Person):

    def __init__(self,name,age,salary):
        Person.__init__(self,name,age)  #必须显式的调用父类初始化方法，不然解释器不会去调用
        self.salary = salary

    def say_introduce(self):
        '''
        重写父类的方法
        :return:
        '''
        print("报告领导，我的名字是：{0}".format(self.name))

print(Teacher.mro())

s = Teacher("ljx",18,1900)
s.say_age()
s.say_introduce()
# print(s.age)
